Add some (safety) code for a consistent behaviour of queue pointers.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 20 Feb 2007 21:02:10 +0000 (21:02 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 20 Feb 2007 21:02:10 +0000 (21:02 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2681 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/queue.c
gpsbabel/waypt.c

index 1c0b54d6593e1e97d984e80dd0d1b00b7d125716..3e81811598c155e602ed0b7d1e33c07c274d4b6a 100644 (file)
@@ -39,6 +39,8 @@ dequeue(queue *element)
 
        next->prev = prev;
        prev->next = next;
+       
+       QUEUE_INIT(element);
        return element;
 }
 
index 57985ed228da28b07e4443e4a490e5ebd736edce..f58179c776684a74ac858b19e363f126f70b2d5d 100644 (file)
@@ -75,7 +75,7 @@ waypt_dupe(const waypoint *wpt)
         * It's important that this duplicated waypoint not appear
         * on the master Q.
         */
-       tmp->Q.next = tmp->Q.prev = NULL;
+       QUEUE_INIT(&tmp->Q);
        tmp->fs = fs_chain_copy( wpt->fs );
 
        return tmp;
@@ -145,6 +145,7 @@ waypt_new(void)
        wpt->fix = fix_unknown;
        wpt->sat = -1;
 
+       QUEUE_INIT(&wpt->Q);
        return wpt;
 }